package cn.edu.xmu.orderpayment.order.microservice;

import cn.edu.xmu.orderpayment.order.microservice.vo.FreightCalculatingPostVo;
import cn.edu.xmu.orderpayment.order.microservice.vo.FreightCalculatingRetVo;
import cn.edu.xmu.orderpayment.order.microservice.vo.SimpleRegionRetVo;
import cn.edu.xmu.privilegegateway.annotation.util.InternalReturnObject;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * @author Li Yixuan 22920192204232
 * @create: 2021/12/19
 */
@FeignClient(value = "freight-service")
public interface FreightService {
    @ApiOperation(value = "计算运费")
    @PostMapping("/regions/{rid}/price")
    InternalReturnObject<FreightCalculatingRetVo> calculateFreight(@PathVariable Long rid, @RequestBody List<FreightCalculatingPostVo> items);

    @GetMapping("internal/region/{id}")
    InternalReturnObject<SimpleRegionRetVo> getRegionById(@PathVariable Long id);

}
